package org.rcgwt.client.ui.grid.provider;

import org.rcgwt.client.ui.grid.IIndexList;
import org.rcgwt.client.ui.grid.event.IIndexesState;

import com.google.gwt.event.logical.shared.HasBeforeSelectionHandlers;
import com.google.gwt.event.logical.shared.HasSelectionHandlers;

/**
 * 
 * Manage the selection list
 * 
 * @author Matthieu ROBERT
 * 
 */
public interface ISelectionProvider extends
        HasSelectionHandlers<IIndexesState>,
        HasBeforeSelectionHandlers<IIndexesState> {

    public enum Cardinality {
        ZEROMANY, ONE, ONEMANY
    }

    int[] getSelection();

    IIndexList getSelectionList();

    void setSelection(int... rowIndexes);

    void setSelection(int start, int count);

    void setSelection(IIndexList indexList);

    void appendSelection(int... rowIndexes);

    void appendSelection(int start, int count);

    void appendSelection(IIndexList indexList);

    void clearSelection(int... rowIndexes);

    void clearSelection(int start, int count);

    void clearSelection(IIndexList indexList);

    void clearAllSelection();

    boolean isRowSelected(int rowIndex);

    // void setCardinality(Cardinality cardinality);

    Cardinality getCardinality();

    int getSelectionCount();

}
